package practice;

import java.util.Random;
import java.util.Scanner;

public class 抢红包 {
    public static void main(String[] args) {
        int[] data = {9,666,999,188};
        red(data);
    }
    public static void red(int[] data){
        Scanner sc = new Scanner(System.in);
        Random r = new Random();

       for (int i = 0; i < data.length; i++) {
           System.out.print("请输入用户名");
           sc.next();
           while(true){
               int n = r.nextInt(data.length);
               int money = data[n];
               if(money != 0){
                   System.out.println("恭喜你抽中红包" + money);
                   data[n] = 0;
                   break;
               }
           }
           System.out.print("活动结束");
       }
    }
}